import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '@/views/Home.vue'
import Error from '@/views/framework/common/Error.vue'

Vue.use(VueRouter)

// 参考博客：https://blog.csdn.net/qq_37805723/article/details/87821069
const routes = [
    { path: '/', redirect: '/login' },
    { path: '/login', component: () => import('@/views/framework/common/Login.vue') },
    { path: '/register', component: () => import('@/views/framework/common/Register.vue') },
    {
        name: 'home',
        path: '/home',
        component: Home,
        children: [
            /// 开发相关
            //组件demo
            {
                path: 'developRelevant/compomentDemo/niupiIM',
                components: { tabContent: () => import('@/views/developRelevant/compomentDemo/niupiIM/niupiIM.vue') }
            }, {
                path: 'developRelevant/compomentDemo/selectTree',
                components: { tabContent: () => import('@/views/developRelevant/compomentDemo/selectTree/selectTree.vue') }
            }, {
                path: 'developRelevant/compomentDemo/editableTable',
                components: { tabContent: () => import('@/views/developRelevant/compomentDemo/editableTable/editableTable.vue') }
            }, {
                path: 'developRelevant/compomentDemo/mindmap',
                components: { tabContent: () => import('@/views/developRelevant/compomentDemo/mindmap/mindmap.vue') }
            }, {
                path: 'developRelevant/compomentDemo/niupiBtn',
                components: { tabContent: () => import('@/views/developRelevant/compomentDemo/niupiBtn/niupiBtn.vue') }
            }, {
                path: 'developRelevant/compomentDemo/icon',
                components: { tabContent: () => import('@/views/developRelevant/compomentDemo/icon/icon.vue') }
            },
            //开发技术解决方案
            {
                path: 'developRelevant/solution/base62',
                components: { tabContent: () => import('@/views/developRelevant/solution/base62/base62.vue') }
            },

            /// framework
            {
                path: 'framework/system/sysMenu',
                components: { tabContent: () => import('@/views/framework/system/sysMenu/sysMenu.vue') }
            }, {
                path: 'framework/system/sysUser',
                components: { tabContent: () => import('@/views/framework/system/sysUser/sysUser.vue') }
            }, {
                path: 'framework/system/sysRole',
                components: { tabContent: () => import('@/views/framework/system/sysRole/sysRole.vue') }
            }
        ]
    },
    { path: '*', component: Error }
]

const router = new VueRouter({
    routes
})

export default router
